clear all
set more off

* Load your final dataset
use "Data/AnalysisData/final_analysis_data.dta", clear

* Sort by state and year
sort state year

* Create lagged state minimum wage variable (previous year's wage)
gen lag_state_min_wage = state_min_wage[_n-1] if state == state[_n-1]

* Calculate the change from previous year
gen change_in_min_wage = state_min_wage - lag_state_min_wage

* Keep only where change is not missing
list state year state_min_wage lag_state_min_wage change_in_min_wage if change_in_min_wage != .

* Save an intermediate version if you want
save "Data/AnalysisData/final_analysis_data_with_changes.dta", replace
* Now make a histogram of changes
histogram change_in_min_wage, width(0.1) frequency color(blue) title("Histogram of Changes in State Minimum Wage") xtitle("Change in State Minimum Wage ($)") ytitle("Number of Observations") graphregion(color(white))

* Save the graph
graph export "Output/DataAppendixOutput/hist_change_in_min_wage.png", replace
* Create a table summarizing common change sizes
contract change_in_min_wage
sort change_in_min_wage
list change_in_min_wage _freq, clean
